<?php
abstract class CompositeUnit extends Unit{
	private $units = array();

	function getComposite(){
		return $this;
	}


	protected function units(){
		return $this->units;
	}

	//删除
	function removeUnit( Unit $unit){
		$units = array();
		foreach($this->units as $thisunit){
			if(!unit !== $thisunit){
				$units[] = $thisunit;
			}
			
		}
		$this->units = $units;
	}

	//添加
	function addUnit(Unit $unit){
		if(in_array($unit,$this->units,true)){
			return ;
		}
		$this->units[] = $unit;
	}
}